<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/bootstrap/css/bootstrap-table.min.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/bootstrap-responsive.css" /> 
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/style.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/bootstrap.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap/bootstrap-table.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap/bootstrap-table-locale-all.min.js"></script> 
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.ext.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/charge.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/skin/css/mobilecss/main.css">
    
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }
        @media (max-width: 980px) {
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
</head>
<body>
<form class="form-inline definewidth m20" action="index.html" method="get">  
    俱乐部ID：
    <input type="text" name="crowdId" id="crowdId"class="abc input-default" placeholder="" value="">&nbsp;&nbsp;  
    <button type="button" onclick="query()" class="btn btn-primary">查询</button>
</form>
<br>
 <table id="mytab" class="table table-striped table-bordered" style="width: 90%;display: none;">
 <tr>
 <td width="30%" style="text-align: right;">俱乐部ID:</td><td width="70%"><label id="crowdIdlab"></label></td>
 </tr>
 <tr>
 <td style="text-align: right;">昵称：</td><td><label id="crowdName"></label></td>
 </tr>
 <tr>
 <td style="text-align: right;">部长昵称:</td><td><label id="outUserName"></label></td>
 </tr>
 <tr>
 <td style="text-align: right;">部长游戏ID:</td><td><label id="gameId"></label> </td>
 </tr>
 <tr style="display: none;">
 <td style="text-align: right;">备注:</td><td><label id="remark"></label></td>
 </tr>
 </table>
 
 
 <div align="center">
 <table id="applyTab" style="display: none;width: 90%;">
 <tr><td colspan="2" width="30%">申请加入<input type="hidden" id="cid" name="" value=""></td></tr>
 <tr><td> 附加信息： </td><td><textarea id="applyRemark" rows="2" cols="3"></textarea></td></tr>
 <tr><td></td><td> <button type="button" onclick="apply()" class="btn btn-primary">申请加入</button></td></tr>
 </table>
 </div>
 <br>
</body>
<script>

//搜索友群信息
function query() {
	var crowdId = $('#crowdId').val();
		if(crowdId.length >= 1) {
	    	//玩家id
   		$.post("${pageContext.request.contextPath}/wechat/crowd_find_data.html",
		        {"crowdId":crowdId},
		  function(data){
	            	var json = eval("("+data+")");
					if(json.statusCode =='200'){
						if(json.crowd!=null){
   							$('.shou_info').css("visibility","visible");
   							$("#crowdIdlab").html(json.crowd.id);
   							$("#crowdName").html(json.crowd.crowdName);
   							$("#outUserName").html(json.crowd.outUserName);
   							$("#gameId").html(json.crowd.gameId);
   							$("#remark").html(json.crowd.remark);
   							$("#cid").val(json.crowd.id);
   							$("#mytab").show();
   							$("#applyTab").show();
						}else{
							$("#cid").val("");
							$("#mytab").hide();
							$("#applyTab").hide();
							layer.alert(" 未搜索到俱乐部信息~ ");
						}
					}
		  });
   	}else{
   		layer.alert(" 请输入俱乐部ID ");
   	}
}

function apply(){
	var crowdId= $("#cid").val();
	var remark =$("#applyRemark").val();
	if(crowdId==""){
		layer.alert(" 请查询你要加入的俱乐部~ ");
		return;
	}
	$.post("${pageContext.request.contextPath}/wechat/crowd_find_save.html",
	        {"crowdId":crowdId,"remark":remark},
	  function(data){
            	var json = eval("("+data+")");
				if(json.statusCode =='200'){
					layer.alert(json.msg);
				}else{
					layer.alert("系统错误，请稍后再试~");
				}
	  });
}

	

</script>
</html>